-
Notifications
You must be signed in to change notification settings - Fork 212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: fusdc uses bech32 address hook encoding #10682
Conversation
3bde1ab
to
0637249
Compare
Deploying agoric-sdk with Cloudflare Pages
|
const hardenOrFreeze = | ||
harden && typeof harden === 'function' ? harden : Object.freeze; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since harden
may not be defined,
const hardenOrFreeze = | |
harden && typeof harden === 'function' ? harden : Object.freeze; | |
const hardenOrFreeze = typeof harden === 'function' ? harden : Object.freeze; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks these changes are now in #10683
a3ba2d1
to
f081d9f
Compare
EudParamShape, | ||
); | ||
const decoded = decodeAddressHook(recipientAddress); | ||
mustMatch(decoded, AddressHookShape); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we check that cctpTxEvidence
contains the correct settlementAccountAddress
anywhere. At one point I thought this was a concern of the EventFeed, but maybe this is the better place to do it.
To avoid increasing scope of this PR, I'll tackle this in a follow up
f081d9f
to
b9c275c
Compare
b9c275c
to
aa488d8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup, this should work.
The comments are mostly one style suggestion that shows up in several places.
const encodedAddr = encodeAddressHook(agoricAddr, { | ||
EUD: destination, | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor style point: I'd much rather see:
const encodedAddr = encodeAddressHook(agoricAddr, { | |
EUD: destination, | |
}); | |
const encodedAddr = encodeAddressHook(agoricAddr, { EUD }); |
with the arg renamed to EUD
. Do we need 2 names for it?
console.log('no EUD parameter', tx.receiver); | ||
return; | ||
} | ||
if (!matches(EUD, M.string())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to go outside JS here.
if (!matches(EUD, M.string())) { | |
if (typeof EUD !== 'string') { |
A pattern match for the whole return value of decodeAddressHook(...)
would make sense.
Does @endo/patterns
have a thing between matches()
and mustMatch()
? i.e. if this doesn't match, give me a good reason why not, not just a boolean false
.
try { | ||
const { EUD } = decodeAddressHook(tx.receiver).query; | ||
if (!EUD) { | ||
console.log('no EUD parameter', tx.receiver); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we want the tracer here, right?
console.log('no EUD parameter', tx.receiver); | |
log('no EUD parameter', tx.receiver); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was copied over but yes, updated
return; | ||
} | ||
if (!matches(EUD, M.string())) { | ||
console.log('EUD is not a string', EUD); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
console.log('EUD is not a string', EUD); | |
log('EUD is not a string', EUD); |
@@ -151,17 +151,23 @@ export const prepareSettler = ( | |||
return; | |||
} | |||
|
|||
if (!addressTools.hasQueryParams(tx.receiver)) { | |||
let endUserDestination; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why a separate name for it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
{ | ||
EUD: 'osmo1234', | ||
extra: 'value', | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe I shouldn't bother with these style nits, but... any particular reason to split this across 4 lines?
{ | |
EUD: 'osmo1234', | |
extra: 'value', | |
}, | |
{ EUD: 'osmo1234', extra: 'value' }, |
const recipientAddress = encodeAddressHook(settleAddr, { | ||
EUD, | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const recipientAddress = encodeAddressHook(settleAddr, { | |
EUD, | |
}); | |
const recipientAddress = encodeAddressHook(settleAddr, { EUD }); |
packages/fast-usdc/test/fixtures.ts
Outdated
{ | ||
EUD: 'osmo183dejcnmkka5dzcu9xw6mywq0p2m5peks28men', | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
feel free to ignore these, but they stick out at me:
{ | |
EUD: 'osmo183dejcnmkka5dzcu9xw6mywq0p2m5peks28men', | |
}, | |
{ EUD: 'osmo183dejcnmkka5dzcu9xw6mywq0p2m5peks28men' }, |
packages/fast-usdc/test/fixtures.ts
Outdated
{ | ||
EUD: 'dydx183dejcnmkka5dzcu9xw6mywq0p2m5peks28men', | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{ | |
EUD: 'dydx183dejcnmkka5dzcu9xw6mywq0p2m5peks28men', | |
}, | |
{ EUD: 'dydx183dejcnmkka5dzcu9xw6mywq0p2m5peks28men' }, |
packages/fast-usdc/test/fixtures.ts
Outdated
{ | ||
EUD: 'random1addr', | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{ | |
EUD: 'random1addr', | |
}, | |
{ EUD: 'random1addr' }, |
ba4fce5
to
d369f08
Compare
a8a6172
to
80fee60
Compare
d369f08
to
6091992
Compare
refs: #10614
Description
@agoric/fast-usdc
uses bech32 encoded address hooks viadecodeAddressHook
andencodeAddressHook
Security Considerations
None
Scaling Considerations
None
Documentation Considerations
None
Testing Considerations
Updates existing tests. Adds an additional test that shows
Advancer
forbids extra query parametersUpgrade Considerations
None, unreleased code